/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package information;

import java.util.logging.Level;
import java.util.logging.Logger;


/**
 *
 * @author TQNINH
 */
public class MethodInfo extends Thread {
     String information[] = {
        "The getName() methods helps to retrieve the name of the current thread.",
        "The start() method allocates the system resources necessary to run " +
            "the thread and executes the run() method of its target object.",
        "The life of a thread starts when the run() method is invoked.",
        "The sleep() method suspend the execution of the current thread " +
            "for a specified period of time.",
        "The interrupt() method tells the thread to stop what it was doing " +
            "before it has completed the task."
    };
    
    public MethodInfo(String name){
        setName(name);
    }
    
    public void run(){
        System.out.println("\nHello!!!");
        System.out.println("My Name is: " + getName() + "\n");
        System.out.println("Today, I am going to tell you in brief about some " +
                "of the methods used in Thread class.\n");
        
        for(int i = 0;i < information.length;i++){
            try {
                Thread.sleep(4000);
            } catch (InterruptedException ex) {
                ex.printStackTrace();
            }
            System.out.println(information[i]);
        }
        System.out.println("\nThank You!!!!!");
    }
}
